package com.alingrad.iou;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class DashboardActivity extends Activity {
	private Button mTransactionsButton;
	private Button mPeopleButton;
	
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dashboard);
        
        final OnClickListener onClickListener = new OnClickListener() {
			@Override
			public void onClick(View v) {
				if (v == mTransactionsButton)
					onTransactionsButtonPressed();
				else if (v == mPeopleButton)
					onPeopleButtonPressed();
			}
		};
        
        mTransactionsButton = (Button)findViewById(R.id.dashboard_launch_transactions);
        mPeopleButton = (Button)findViewById(R.id.dashboard_launch_people);
        mTransactionsButton.setOnClickListener(onClickListener);
        mPeopleButton.setOnClickListener(onClickListener);
    }
    
    private void onTransactionsButtonPressed() {
    	Intent i = new Intent(this, TransactionsActivity.class);
    	startActivity(i);
    }
    
    private void onPeopleButtonPressed() {
    	Intent i = new Intent(this, PeopleActivity.class);
    	startActivity(i);
    }
    
    @Override
    public void onBackPressed() {
    	finish();
    }
}